package com.cs171.market.Repository;

import com.cs171.market.entity.User;
import com.cs171.market.entity.UserTable;
import com.github.pagehelper.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author Endy
 * @create 2020 - 05 - 21 - 20:37
 * @date 2020/5/21 - 20:37
 */

@Repository
public interface UserRepository extends JpaRepository<User,Integer> {

    //@Query("select p.uid as uid, p.uname as uname, p.uphone as uponr, p.uemail as uemail, p.uaddress as uaddress from User p where p.uname=?1 and p.upassword=?2")
    //List<Map<Integer,Object>> getJsonAboutUserByName(String user, String password);
    //@Query("select p.uid as uid, p.uname as uname, p.uphone as uponr, p.uemail as uemail, p.uaddress as uaddress from User p where p.uid=?1 and p.upassword=?2")
    //List<Map<Integer,Object>> getJsonAboutUserById(Integer id, String password);
    @Query("select p from User p where p.uname=?1")
    User findByUsername(String username);
    @Query("select p from User p ")
    List<User> findByAllUser();

}
